package com.kdpujie.alink.source;

import com.alibaba.alink.operator.batch.source.BaseSourceBatchOp;
import com.alibaba.alink.operator.batch.source.CsvSourceBatchOp;

public class SSPCtrSource<T extends BaseSourceBatchOp<T>> implements Source<T>{
    

    @Override
    public String GetLabelName() {
        return "is_click";
    }

    @Override
    public String[] GetCategoryColsName() {
        String[] categoryColsNames = new String[] {
            "publisher_id", "app_id", "package_name", "app_ver", "province_code", "city_code", "district_code", "os_type", "os_ver", "device_type", "device_brand", "device_model", "conn_type", "screen_size", "carrier_code",
            "request_ipv4", "request_ua", "ad_slot_id", "ad_type", "creative_id", "ads_id", "request_hour"
        };
        return categoryColsNames;
    }

    @Override
    public String[] GetColsName() {
        String[] colsName = new String[] {
            "publisher_id", "app_id", "package_name", "app_ver", "province_code", "city_code", "district_code", "os_type", "os_ver", "device_type", "device_brand", "device_model", "conn_type", "screen_size", "screen_orient", "carrier_type", "carrier_code",
            "request_ipv4", "request_ua", "ad_slot_id", "ad_type", "creative_id", "ads_id", "request_hour"
        };
        return colsName;
    }

    @Override
    public String[] GetNumericalColsNames() {
        String[] numericalColsNames = new String[] {
            "screen_orient", "carrier_type"
        };
        return numericalColsNames;
    }

    @Override
    public T GetSource() {
        // String schemaStr = "request_id string, ubix_id string, publisher_id string, app_id string, package_name string, app_ver string, app_fix_ver string, province_code string, city_code string, district_code string, os_type string, " +
        //                 "os_ver string, os_fix_ver string, device_type string, device_brand string, device_model string, language string, hw_model string, hw_machine string, conn_type string, screen_size string, screen_dpi string, screen_orient string, " + 
        //                 "carrier_type string, carrier_code string, startup_time string, mb_time string, cpu_num string, disk_capacity float, mem_capacity float, auth_status string, battery_power string, request_ipv4 string, request_real_ip string, request_ua string, " + 
        //                 "ad_slot_id string, ad_type string, ad_is_dpl string, ad_is_macro string, ad_click_region string, creative_id string, creative_type string, creative_title string, creative_desc string, creative_package_name string, creative_img_size string, " + 
        //                 "creative_video_size string, ads_id string, ads_account_id string, ads_group_id string, ads_campaign_id string, ads_bid_type string, ads_bid_price string, ads_high_ecpm float, ads_second_ecpm float, predict_debug float, " + 
        //                 "is_dsp_win string, level string, docking_type string, request_hour string, request_weekday string, request_time string, show_ipv4 string, show_ua string, show_time string, show_anti_code string, click_cvu_flag string, click_ipv4 string, click_ua string, " +
        //                 "click_time string, is_show string, is_click string";
        String schemaStr = "is_click string, publisher_id string, app_id string, package_name string, app_ver string, province_code string, city_code string, district_code string, os_type string, os_ver string, device_type string, device_brand string, " +
                           "device_model string, conn_type string, screen_size string, screen_dpi string, screen_orient string, carrier_type string, carrier_code string, " +
                           "request_ipv4 string, request_ua string, ad_slot_id string, ad_type string, creative_id string, ads_id string, request_hour string";

        CsvSourceBatchOp data = new CsvSourceBatchOp()
        .setFilePath("/Users/pujie/codes/data/query-hive-8132.csv")
        .setSchemaStr(schemaStr).setIgnoreFirstLine(true);
        return (T)data;
    }
    
}
